package tools

const (
	SUCCSE = 200
	ERROR = 500

	// code = 1000.... gin 模块错误

	// code = 2000.... 数据库模块错误

	// code = 3000.... Docker 模块错误
	ERROR_DOCKER_CLIENT=3000
	ERROR_IMAGE_CHECK=30001
	ERROR_IMAGE_ALWAYS_EXIT=30002
	ERROR_IMAGE_PULL=30003
	ERROR_IMAGE_TAG=30004
	ERROR_IMAGE_PUSH=30005
	ERROR_IMAGE_LIST=30006
	ERROR_IMAGE_ALWAYS_EXIT_PUSH=30007
	ERROR_IMAGE_NOT_EXIT=30008
	ERROR_IMAGE_PUSH_ONCE=30009
	ERROR_IMAGE_QUERY=30010
	ERROR_IMAGE_QUERY_LIST=30011

	ERROR_IMAGE_QUERY_RETURN=30012
)

var codeMsg = map[int]string{
	SUCCSE: "成功",
	ERROR: "失败",
	ERROR_DOCKER_CLIENT: "Docker client 初始化失败",
	ERROR_IMAGE_CHECK: "镜像查重失败",
	ERROR_IMAGE_ALWAYS_EXIT: "镜像查重存在",
	ERROR_IMAGE_PULL: "镜像下载失败",
	ERROR_IMAGE_TAG: "镜像tag失败",
	ERROR_IMAGE_PUSH: "镜像推送失败",
	ERROR_IMAGE_LIST: "镜像列出失败",
	ERROR_IMAGE_ALWAYS_EXIT_PUSH: "镜像列出失败",
	ERROR_IMAGE_NOT_EXIT: "镜像不存在",
	ERROR_IMAGE_PUSH_ONCE: "单上传镜像功能失败",
	ERROR_IMAGE_QUERY: "镜像查询失败",
	ERROR_IMAGE_QUERY_LIST: "镜像列表失败",
	ERROR_IMAGE_QUERY_RETURN: "不存在此镜像，先执行下载后可以查看",
}

func GetErrMsg(code int) string{
	return codeMsg[code]
}
